home *** CD-ROM | disk | FTP | other *** search
- //----------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------
- //
- // Filename : gamemain.h
- // Description : Header file for GameMain class
- // Author : Marnich van Rensburg (2002)
- //
- //----------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------
-
- #include <windows.h>
- #include <time.h> // For time()
- #include <stdlib.h> // For srand() and rand()
- #include "opengl.h"
- #include "tetramino.h"
- #include "container.h"
- #include "top10.h"
-
- //----------------------------------------------------------------------------------------
- // External Globals
- //----------------------------------------------------------------------------------------
-
- extern bool SoundActive;
- extern bool StarFieldActive;
-
-
- //----------------------------------------------------------------------------------------
- // Constants
- //----------------------------------------------------------------------------------------
-
- #ifndef GAMEMAIN_H
- #define GAMEMAIN_H
-
-
- #define GAME_NAME Tetron
-
- //Player Actions
- #define PLR_MOVE_RIGHT VK_RIGHT
- #define PLR_MOVE_LEFT VK_LEFT
- #define PLR_MOVE_DOWN VK_DOWN
- #define PLR_MOVE_DROP 45
- #define PLR_ROTATE_LEFT 190
- #define PLR_ROTATE_RIGHT 188
-
-
- //Scoring Defaults
- #define SCR_TETRAMINO_DROPPED 4
- #define SCR_ONE_LINE_REMOVED 10
- #define SCR_TWO_LINES_REMOVED 25
- #define SCR_THREE_LINES_REMOVED 75
- #define SCR_FOUR_LINES_REMOVED 300
-
- //Game Modes
- #define GAME_START_SCREEN 1
- #define GAME_ACTIVE 2
- #define GAME_NEW_HIGHSCORE 3
-
-
-
- //----------------------------------------------------------------------------------------
- // Class Definition for GameMain Class
- //----------------------------------------------------------------------------------------
-
- class GameMain
- {
- //---------------------- Public -------------------------
-
- public:
-
- // Member Functions
- int Mode; // Current state of game
- GameMain(); // Constructor
- bool GameOver;
- bool Init(); // Prepares for running the game returns false if failed
- void New(); // Reset the game
- void StartScreen(unsigned char UserAction); // Displays main startup screen
- void Play(unsigned char UserAction); // Initiates gameplay sequence ie. the Gameloop
- void GetHighScore(unsigned char UserAction);
- void Quit(); // Shutdown
-
- //---------------------- Private -------------------------
-
- private:
-
- //Data Members
- OpenGL GameGL; // OpenGL Object For Graphics
- Container ConCurrent; // Container Object
- Tetramino TetCurrent; // Tetramino currently in play
- Tetramino TetNext; // Tetramino to be used next
- GameStats Stats; // Holds all game statistics ie. score etc.
- Top10 HighScores; // Table of top ten highscores
- unsigned int Speed; // Tetranimo falling speed
- bool Drop; // true while tetranimo is being droped
- char DropHeight; // The hight from wich the tetramino was dropped used in scoring
- char DropStarty;
-
- // Member Functions
- char Random(); // For generating random tetraminos
- void Render(); // Render the game onto the screen
- void SetScore(char NoOfLines); // Calculates new score
- void StartNext(); // Sets NEXT piece to CURRENT and inits another NEXT piece
-
- bool ValidInput(unsigned char Val); // verifies user text input
-
- };//Class GameMain
-
- #endif;